-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add callbacks for resample and benchmark #1214
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I think we should also provide an example for how to implement a custom callback.
|
tab = as.data.table(bmr, data_extra = TRUE) | ||
expect_data_table(tab) | ||
expect_names(names(tab), disjunct.from = "data_extra") | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there any interesting cases where workhorse() is executed in a different (parallelization cluster) process that might be interesting here that should be tested?
Callbacks will behave differently depending on the parallelization. task = tsk("pima")
learner = lrn("classif.rpart")
resampling = rsmp("cv", folds = 3)
callback = callback_evaluation("test",
on_evaluation_begin = function(callback, context) {
if (context$iteration == 1) context$task$select(c("age", "insulin"))
}
)
rr = resample(task, learner, resampling, callbacks = callback)
rr$learners[[1]]$state$feature_names
# > [1] "age" "insulin"
rr$learners[[2]]$state$feature_names
# > [1] "age" "insulin"
with_future("multisession", {
rr = resample(task, learner, resampling, callbacks = callback)
})
rr$learners[[1]]$state$feature_names
# > [1] "age" "insulin"
rr$learners[[2]]$state$feature_names
# > [1] "age" "glucose" "insulin" "mass" "pedigree" "pregnant" "pressure" "triceps" I think we should not clone these objects to get a consistent behavior. This will add unnecessary overhead. This is now documented in |
Use cases:
|
Additional overhead is less than 3% when using 10ms models